scripts.
This fixes a bug with xm-test not working on 64-bit systems.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
# -*- mode: python; -*-
#============================================================================
# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
-# Copyright (C) 2005 XenSource Ltd
+# Copyright (C) 2005-2006 XenSource Inc
#============================================================================
"""Xen management daemon.
and recover its state when restarted.
"""
import os
+import os.path
import sys
import socket
import signal
import time
import commands
-# add fallback path for non-native python path installs if needed
-sys.path.append('/usr/lib/python')
-sys.path.append('/usr/lib64/python')
+
+# Use the auxbin module in Xend to determine the correct Python path. We
+# take the first installed instance of auxbin that we find, and then run it
+# to determine the correct path, appending that to sys.path.
+
+AUXBIN = 'xen/util/auxbin.py'
+
+for p in ['python%s' % sys.version[:3], 'python']:
+ for l in ['/usr/lib64', '/usr/lib']:
+ d = os.path.join(l, p)
+ if os.path.exists(os.path.join(d, AUXBIN)):
+ sys.path.append(d)
+ import xen.util.auxbin
+ libpath = xen.util.auxbin.libpath()
+ sys.path = sys.path[:-1]
+ sys.path.append(libpath)
+ break
+
from xen.xend.server import SrvDaemon
class CheckError(ValueError):
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#============================================================================
-# Copyright (C) 2005 XenSource Ltd
+# Copyright (C) 2005-2006 XenSource Inc.
#============================================================================
-LIB_BIN_32 = "/usr/lib/xen/bin"
-LIB_BIN_64 = "/usr/lib64/xen/bin"
+LIB_32 = "/usr/lib"
+LIB_64 = "/usr/lib64"
+LIB_BIN_SUFFIX = "xen/bin"
-## The architectures on which the LIB_BIN_64 directory is used. This
+## The architectures on which the LIB_64 directory is used. This
# deliberately excludes ia64.
LIB_64_ARCHS = [ 'x86_64', 'ppc64', 's390x', 'sparc64']
def path():
+ return os.path.join(libpath(), LIB_BIN_SUFFIX)
+
+
+def libpath():
machine = os.uname()[4]
- if machine in LIB_64_ARCHS and os.path.exists(LIB_BIN_64):
- return LIB_BIN_64
+ if machine in LIB_64_ARCHS and os.path.exists(LIB_64):
+ return LIB_64
else:
- return LIB_BIN_32
+ return LIB_32
# are two levels above the tests
TESTLIB=../../lib
RD_PATH=../../ramdisk
-TENV="PYTHONPATH=$PYTHONPATH:$TESTLIB:/usr/lib/python RD_PATH=$RD_PATH"
+TENV="PYTHONPATH=$PYTHONPATH:$TESTLIB RD_PATH=$RD_PATH"
AC_ARG_ENABLE(hvm-support,
[[ --enable-hvm-support enable hardware virtual machine assist]],
from XenDevice import *
from NetConfig import *
-# Make sure xen modules are in path
-sys.path.append('/usr/lib/python')
+# Use the auxbin module in Xend to determine the correct Python path. We
+# take the first installed instance of auxbin that we find, and then run it
+# to determine the correct path, appending that to sys.path.
+
+AUXBIN = 'xen/util/auxbin.py'
+
+for p in ['python%s' % sys.version[:3], 'python']:
+ for l in ['/usr/lib64', '/usr/lib']:
+ d = os.path.join(l, p)
+ if os.path.exists(os.path.join(d, AUXBIN)):
+ sys.path.append(d)
+ import xen.util.auxbin
+ libpath = xen.util.auxbin.libpath()
+ sys.path = sys.path[:-1]
+ sys.path.append(libpath)
+ break
# Give this test a clean slate
-destroyAllDomUs();
+destroyAllDomUs()
if os.environ.get("TEST_VERBOSE"):
verbose = True